<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>随机页面</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/fastclick.js"></script>
    <style>
        #wrap {
            height: 100%;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
            flex-flow: column;
        }

        #header {
            background: #fff;
            color: #323232;
            border-bottom: #b2b2b2 solid 1px;
        }

        #main {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
        }
    </style>
</head>

<body>
    <div v-cloak id="wrap">
        <header id="header" class="aui-bar aui-bar-nav">
            <a class="aui-pull-left">
                <span class="aui-iconfont aui-icon-left" style="color:#000" @click="leftWin" id="headerBack">返回</span>
            </a>
            <div class="aui-title" id="headerText" v-text="headerText"></div>
        </header>
        <div id="main" class="flex-con" style="height: 800px"></div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function() {
        open();
        FastClick.attach(document.body);
        var vm = new Vue({
            el: '#wrap',
            data: {
                headerBack: '一定要借到',
                headerText: 'loading...'
            },
            methods: {
                leftWin: function() {
                    api.closeWin();
                }
            },
            created: function() {},
            mounted: function() {
              var link = api.pageParam.type
              if (link === 'frame1') {
                this.headerText = '用户协议'
              } else {
                this.headerText = '隐私协议'
              }
            },
        })
        headerBack = $api.byId('headerBack');
        headerText = $api.byId('headerText');


    };


    var header, headerPos, main, mainPos

    function open() {
        var link = api.pageParam.type
        header = $api.byId('header');
        //适配iOS 7+，Android 4.4+状态栏
        $api.fixStatusBar(header);
        headerPos = $api.offset(header);
        main = $api.byId('main');
        mainPos = $api.offset(main);
        if (link === 'frame1') {
            api.openFrame({
                name: 'link_frame1',
                url: 'https://static.8jieyun.com/download/xiaotangUserAgreement.html',
                bounces: false,
                rect: {
                    x: 0,
                    y: headerPos.h,
                    w: 'auto'
                }
            });
        } else {
            api.openFrame({
                name: 'link_frame2',
                url: 'https://static.8jieyun.com/download/xiaotangAppPrivacyPolicy.html',
                bounces: false,
                rect: {
                    x: 0,
                    y: headerPos.h,
                    w: 'auto'
                }
            });
        }
    }
</script>

</html>
